package ts

import (
	"fmt"
	"github.com/aliyun/aliyun-tablestore-go-sdk/tablestore"
	"purchase-mall/conf"
)

var tsDb *tablestore.TableStoreClient

// Init 初始化TableStore连接
func Init(cfg *conf.TsConfig) (err error) {
	fmt.Printf("TableStore Switch %v\n", cfg.Switch)
	if cfg.Switch == false {
		return nil
	}
	tsDb = tablestore.NewClient(cfg.EndPoint, //your endpoint，此处可选择公网地址
		cfg.InstanceName,    //your instance name
		cfg.AccessKeyId,     //your accessKeyId
		cfg.AccessKeySecret) //your accessSecret
	//ListTable(client)
	//SQLSelect(client)
	return nil
}
